import time
from celery import Celery

# 定义broker
broker = "redis://127.0.0.1:6379/1"

# 定义backend
backend = "redis://127.0.0.1:6379/2"

# 获取Celery实例
app = Celery("demo",broker = broker,backend = backend,
             include=['celery_task.email.send_email','celery_task.order.make_order'])

# 配置时区
app.conf.timezone = 'Asia/Shanghai'
# 禁止使用UTC时间
app.conf.enable_utc = False

app.conf.beat_schedule = {
    'add-every-30-seconds': {
        'task': 'celery_task.email.send_email.send',
        'schedule': 5.0,
        'args': ('lbwhite@163.com',),
    },
}